import request from '@/utils/request'
//从url将数据发送请求，后端收到url后处理数据，返回结果

export default{
    //1 讲师列表（条件查询分页）
    //current当前页 limit每页记录数 teacherQuery条件对象
    getTeacherListPage(current,limit,teachQuery ){

        return request({
        // url: '/eduservice/edu-teacher/pageTeacherCondition/'+current +'/'+limit,
        url: `/eduservice/edu-teacher/pageTeacherCondition/${current}/${limit}`,
        method: 'post',
       //teacherQuery条件对象，后端使用RequestBody获取数据
       //data表示把对象转换json进行传递到接口里面,params: { token }是单独传参数
        data: teachQuery,  //老是喜欢把 data 写成date 导致ajax请求的条件查询对象发送不出去。。又不报错。晕死
         //发送的对象，通过后台requestbody的对象接受，他们的对象名称可以不一样，都是通过json传输的，属性名对上其实就可以了。
         
        })
    },
    //2，逻辑删除讲师
    deleteTeacherId(id){

        return request({
           url: `/eduservice/edu-teacher/${id}`,
           method: 'delete',

        })
    },
    //3，新增讲师
    addTeacher(eduTeacher){

        return request({
           url: `/eduservice/edu-teacher/addTeacher`,
           method: 'post',
           data:eduTeacher

        })
    },
    //根据id查询讲师对象
    getTeacherInfo(id){

        return request({
            url: `/eduservice/edu-teacher/getTeacher/${id}`,
            method: 'get',
        })

    },

    //3，新增讲师
    updateTeacherInfo(eduTeacher){

        return request({
           url: `/eduservice/edu-teacher/updateTeacher`,
           method: 'post',
           data:eduTeacher

        })
    },
    

}

